﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace VisualImageTest
{
	public partial class MainPage : UserControl
	{
		public MainPage()
		{
			InitializeComponent();

			CompositionTarget.Rendering += delegate
			{
				if ( liveRefresh.IsChecked.GetValueOrDefault( false ) )
				{
					myTextImage.Invalidate();
					myRoundedImage.Invalidate();
				}
			};
		}

		private void Slider_ValueChanged( object sender, RoutedPropertyChangedEventArgs<double> e )
		{
			// If live refresh disabled, cheat a little...
			if ( liveRefresh != null && !liveRefresh.IsChecked.GetValueOrDefault( false ) )
			{
				myRoundedImage.Invalidate();
			}
		}

		private void Scale_ValueChanged( object sender, RoutedPropertyChangedEventArgs<double> e )
		{
			if ( imageScale != null && scale != null )
			{
				imageScale.ScaleX = imageScale.ScaleY = scale.Value;
			}
		}
	}
}
